package com.atguigu;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/servletA")
public class servletA extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //创建cookie
        Cookie cookie1=new Cookie("keya","valuea");
        //cookie1.setMaxAge(60*5);
        cookie1.setPath("/demo/servletB");
        Cookie cookie2=new Cookie("keyb","valueb");
        //将cookie放入响应报文
        resp.addCookie(cookie1);
        resp.addCookie(cookie2);
    }
}
